/* $Id: ClientRegistrationFacade.java 
 * Copyright (C) 2011, TRAKHEES
 *  
 * Revision History
 *
 * Date  			Author 		    	Remarks
 * ---------------------------------------------------------------------------------
 *
 */
package ae.pcfc.etks.online.common.facade;

import java.util.List;

import ae.pcfc.etks.online.common.domain.Client;
import ae.pcfc.etks.online.common.domain.ServiceRole;
import ae.pcfc.etks.online.common.vo.AdminApprovalVO;
import ae.pcfc.etks.online.common.vo.AppMetaDataDetailVO;
import ae.pcfc.etks.online.common.vo.ClientCompanyReqVO;
import ae.pcfc.etks.online.common.vo.ClientCompanyVO;
import ae.pcfc.etks.online.common.vo.ClientPersonReqVO;
import ae.pcfc.etks.online.common.vo.ClientPersonVO;
import ae.pcfc.etks.online.common.vo.ClientRoleVO;
import ae.pcfc.etks.online.common.vo.CompanyDetailVO;
import ae.pcfc.etks.online.common.vo.CompanySearchCriteriaVO;
import ae.pcfc.etks.online.common.vo.CompanySearchVO;
import ae.pcfc.etks.online.common.vo.IPageVO;
import ae.pcfc.etks.online.common.vo.SCCompanyVO;
import ae.pcfc.etks.online.common.vo.SCPersonVO;
import ae.pcfc.etks.online.common.vo.SearchCriteriaCompanyVO;
import ae.pcfc.etks.online.common.vo.SearchCriteriaPersonVO;
import ae.pcfc.etks.online.common.vo.TrakheesIdAndPINVO;
import ae.pcfc.etks.online.common.vo.UserVO;
import ae.pcfc.etks.online.wf.service.client.vo.ClientRoleCompleteStepVO;
import ae.pcfc.etks.online.wf.service.client.vo.LaunchIncidentVO;

public interface ClientRegistrationFacade extends Facade {

	/**
	 * registerCompany
	 * Method to register Client Company
	 * @param clientCompanyReqVO
	 * @return
	 * String
	 */
	public String registerCompany(ClientCompanyReqVO clientCompanyReqVO);

	/**
	 * registerPerson
	 * Method to register Person
	 * @param clientPersonReqVO
	 * @return
	 * String
	 */
	public String registerPerson(ClientPersonReqVO clientPersonReqVO);

	/**
	 * updatePerson
	 * Method to update person
	 * @param userVO
	 * void
	 */
	public void updatePerson(UserVO userVO);

	/**
	 * updateCompany
	 * Method to update client company
	 * @param userVO
	 * void
	 */
	public void updateCompany(UserVO userVO);

	/**
	 * getCompanyRegisteration
	 * Method to company detail information by search criteria
	 * @param companySearchVO
	 * @return
	 * CompanyDetailVO
	 */
	public CompanyDetailVO getCompanyRegisteration(CompanySearchVO companySearchVO);

	/**
	 * validateTrakheesIdAndPIN
	 * Method to validate trakhees id and pin
	 * @param idAndPINVO
	 * @return
	 * boolean
	 */
	public boolean validateTrakheesIdAndPIN(TrakheesIdAndPINVO idAndPINVO);

	/**
	 * findSCPersonByTrakheesId
	 * Method to find client person by trakhees id
	 * @param id
	 * @return
	 * SCPersonVO
	 */
	public SCPersonVO findSCPersonByTrakheesId(String id);

	/**
	 * findSCCompanyByTrakheesId
	 * Method to find client company by trakhees id
	 * @param trakheesId
	 * @return
	 * SCCompanyVO
	 */
	public SCCompanyVO findSCCompanyByTrakheesId(String trakheesId);

	/**
	 * findClientPersonByUserName
	 * Method to find client person by the user registered under it
	 * @param userName
	 * @return
	 * ClientPersonVO
	 */
	public ClientPersonVO findClientPersonByUserName(String userName);

	/**
	 * findClientCompanyByUserName
	 * Method to find client company by the user registered under it
	 * @param userName
	 * @return
	 * ClientCompanyVO
	 */
	public ClientCompanyVO findClientCompanyByUserName(String userName);

	/**
	 * findTakheesIdByUserName
	 * Method to find trakhees id by user registered under it
	 * @param userName
	 * @return
	 * String
	 */
	public String findTakheesIdByUserName(String userName);

	/**
	 * searchCompanyRegisterationList
	 * Method to get page information based on search criteria
	 * @param companySearchCriteriaVO
	 * @return
	 * IPageVO
	 */
	public IPageVO searchCompanyRegisterationList(CompanySearchCriteriaVO companySearchCriteriaVO);

	/**
	 * findPersonAvailableRoleByUserName
	 * Method to find list of client roles available for registration for a user
	 * @param strUserName
	 * @return
	 * List<ClientRoleVO>
	 */
	public List<ClientRoleVO> findPersonAvailableRoleByUserName(String strUserName);
	
	/**
	 * addClientRoleReq
	 * Method to add client role request
	 * @param strUserName
	 * @param roleIds
	 * @param appMetaDataVO
	 * @return
	 * String
	 */
	public String addClientRoleReq(String strUserName, List<Long> roleIds, AppMetaDataDetailVO appMetaDataVO);
	
	/**
	 * findClientReqRoleByApplicationId
	 * Method to find client role request by application id
	 * @param applicationId
	 * @return
	 * List<ClientRoleVO>
	 */
	public List<ClientRoleVO> findClientReqRoleByApplicationId(String applicationId);
	
	/**
	 * reviewClientRoleRequest
	 * Method to update the approval action on the Client Role Request application by Admin
	 * This method calls the DomainObjectManagers of AppMetaData, ProcessAction, ProcessComments to update the details
	 * Also, this associates the Client to the Roles in TSC DB if the request is approved by the admin
	 * @param	adminApprovalVO - Contains information about the admin approval action
	 * void
	 */
	public ClientRoleCompleteStepVO reviewClientRoleRequest(AdminApprovalVO adminApprovalVO, List<ServiceRole> returnServiceRoles);
	
	/**
	 * findTrakheesIdByApplicationId
	 * Method to find trakhees id associated with an application
	 * @param id
	 * @return
	 * String
	 */
	public String findTrakheesIdByApplicationId(String id);
	
	/**
	 * findClientUserByEmail
	 * Method to find client by the email address of the user registered under it
	 * @param userName
	 * @return
	 * Client
	 */
	public Client findClientUserByEmail(String userName);
	
	/**
	 * findTrakheesIdAndPinByEmail
	 * Method to find trakhees id and pin based on the client email
	 * @param email
	 * @return
	 * TrakheesIdAndPINVO
	 */
	public TrakheesIdAndPINVO findTrakheesIdAndPinByEmail(String email);

	/**
	 * findTrakheesIdAndPinByLicenseInfo
	 * 
	 * @param searchCriteriaCompanyVO
	 * @return
	 * TrakheesIdAndPINVO
	 */
	public TrakheesIdAndPINVO findTrakheesIdAndPinByLicenseInfo(SearchCriteriaCompanyVO searchCriteriaCompanyVO);
	/**
	 * Description:
	 * updateWorkflowIncidentVO:	Method to update the LaunchIncidentVO based on the client roles the Service.
	 * This method finds the client roles of the Service, find its corresponding departments and sets the department flag in the LaunchIncidentVO
	 * By default, Finance Department is set to mandatory approval department, irrespective of the service role of the service 
	 * @author Dicetek.Ismail
	 * @param	LaunchIncidentVO - The workflow incident object which needs to be updated with the approval departments
	 * @param	- List<String> - List of String objects which are client role ids 
	 * 
	 */	
	public void updateWorkflowIncidentVO(LaunchIncidentVO launchIncidVO, List<String> clientRoles);

	/**
	 * reviewClientRoleRequest
	 * Method to undo the approval action on the Client Role Request application by Admin
	 * This method calls the DomainObjectManagers of AppMetaData, ProcessAction, ProcessComments to undo the updates
	 * @param	adminApprovalVO - Contains information about the admin approval action
	 * void
	 * @param returnServiceRoles 
	 */
	public void undoReviewClientRoleRequest(AdminApprovalVO adminApprovalVO, List<ServiceRole> returnServiceRoles);

	public void updateCompanyWorkflowIncidentVO(LaunchIncidentVO launchIncidVO, String strTrakheesId);
	
	public void updatePersonWorkflowIncidentVO(LaunchIncidentVO launchIncidVO, String strTrakheesId);

	public boolean validateRegisterCompany(ClientCompanyReqVO clientCompanyReqVO);
	
	public boolean validateRegisterPerson(ClientPersonReqVO clientPersonReqVO);

	public List<ClientRoleVO> findCurrentRolesByUserName(String strUserName);

	public List<SCCompanyVO> findCompany(SearchCriteriaCompanyVO searchCriteriaCompanyVO);

	public List<SCPersonVO> findPerson(SearchCriteriaPersonVO searchCriteriaPersonVO);
	
}
